﻿using System;
using UnityEngine;

namespace RootMotion.Demos
{
	// Token: 0x020000A4 RID: 164
	[RequireComponent(typeof(FPSAiming))]
	[RequireComponent(typeof(Animator))]
	public class FPSCharacter : MonoBehaviour
	{
		// Token: 0x06000571 RID: 1393 RVA: 0x00005777 File Offset: 0x00003977
		public void Start()
		{
			this.animator = base.GetComponent<Animator>();
			this.FPSAiming = base.GetComponent<FPSAiming>();
		}

		// Token: 0x06000572 RID: 1394 RVA: 0x000354E0 File Offset: 0x000336E0
		public void Update()
		{
			this.FPSAiming.sightWeight = Mathf.SmoothDamp(this.FPSAiming.sightWeight, (!Input.GetMouseButton(1)) ? 0f : 1f, ref this.sVel, 0.1f);
			if (this.FPSAiming.sightWeight < 0.001f)
			{
				this.FPSAiming.sightWeight = 0f;
			}
			if (this.FPSAiming.sightWeight > 0.999f)
			{
				this.FPSAiming.sightWeight = 1f;
			}
			this.animator.SetFloat("Speed", this.walkSpeed);
		}

		// Token: 0x06000573 RID: 1395 RVA: 0x00005791 File Offset: 0x00003991
		public void OnGUI()
		{
			GUI.Label(new Rect((float)(Screen.width - 210), 10f, 200f, 25f), "Hold RMB to aim down the sight");
		}

		// Token: 0x0400045D RID: 1117
		[Range(0f, 1f)]
		public float walkSpeed = 0.5f;

		// Token: 0x0400045E RID: 1118
		public float sVel;

		// Token: 0x0400045F RID: 1119
		public Animator animator;

		// Token: 0x04000460 RID: 1120
		public FPSAiming FPSAiming;
	}
}
